package com.ximu.service_home.config;

import com.baomidou.mybatisplus.annotation.DbType;
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @projectName: HomePage
 * @package: com.ximu.service_base.service_home.config
 * @className: MybatisPlusConfig
 * @author: ximu
 * @description: MybatisPlus配置类
 * @date: 2022/4/25 8:47
 * @version: 1.0
 */
@Configuration
@MapperScan("com.ximu.service_home.mapper")
public class MybatisPlusConfig {

    /*
     * @param :
      * @return MybatisPlusInterceptor
     * @author ximu
     * @description 分页插件
     * @date 2022/4/25 8:48
     */
    @Bean
    public MybatisPlusInterceptor mybatisPlusInterceptor() {
        MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
        // 向MyBatis-Plus的过滤器链中添加分页拦截器，需要设置数据库类型（主要用于分页方言）
        interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL));
        return interceptor;
    }

}
